package com.example.myapplication.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.Toast;

import com.example.myapplication.R;
import com.example.myapplication.app.MyApplication;
import com.example.myapplication.widget.AButton_;

import org.androidannotations.annotations.AfterExtras;
import org.androidannotations.annotations.App;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.Extra;
import org.androidannotations.annotations.ViewById;

@EActivity(R.layout.activity_second)
//@EActivity
public class SecondActivity extends AppCompatActivity {
    @ViewById
    Button btn_C;
    @App
    MyApplication application;
    @Extra
    String message;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 自定义View可做背景布局
//        setContentView(AButton_.build(this));
        Intent intent = this.getIntent();
        Bundle bundle = intent.getExtras();
        if (bundle != null) {
            Toast.makeText(this, "extra: "+ bundle.getString("key_value"),
                    Toast.LENGTH_SHORT).show();
        }
    }
    @Click(R.id.btn_C)
    public void clickButton() {
        Toast.makeText(this, application.getmTemp().get("key").toString(),
                Toast.LENGTH_SHORT).show();
    }
    @AfterExtras
    public void showExtras() {
        Log.d("@AfterExtras", "showExtras: ...");
    }
}
